<template>
  <div>
    <search-header @change="getSearchMovie" :list="list"></search-header>
  </div>
</template>

<script>
import SearchHeader from './components/Header'
import axios from 'axios'
export default {
  name: 'Search',
  components: {
    SearchHeader
  },
  data () {
    return {
      list: [],
      hiscondata: ''
    }
  },
  methods: {
    getSearchMovie (val) {
      axios.get('/api/movie/search', {
        params: {
          q: val
        }
      }).then(this.getMovieSucc)
    },
    getMovieSucc (res) {
      res = res.data
      if (res) {
        const data = res.subjects
        this.list = data
      }
    }
  }
}
</script>

<style scoped lang="stylus">
  .search
    color: #000
</style>
